
getLocation();
function getLocation(){
    if(navigator.geolocation){
        //document.write(str);
        var geolocation = new BMap.Geolocation();//创建定位实例
        geolocation.getCurrentPosition(showLocation,{enableHighAccuracy: true});//enableHighAccuracy 要求浏览器获取最佳结果
    }else{
        map.addControl(new BMap.GeolocationControl());//添加定位控件 支持定位
    }
}

function showLocation(r){
    longitude = r['longitude'];
    latitude  = r['latitude'] ;
    getShops();
    if(typeof(loadMap) != "undefind"){
        getCity(longitude,latitude);
    }
}
